buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:0.9.+'
    }
}
apply plugin: 'android'
apply plugin: 'maven'

repositories {
    mavenLocal()
    maven { url "http://thaliartifactory.cloudapp.net/artifactory/libs-snapshot" }
    maven { url "http://thaliartifactory.cloudapp.net/artifactory/libs-release" }
    maven { url 'http://files.couchbase.com/maven2/' }
    mavenCentral()
}

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.3"

    defaultConfig {
        minSdkVersion 19
        targetSdkVersion 19
        versionCode 1
        versionName "1.0"
    }
    // Needed to work around https://code.google.com/p/android/issues/detail?id=61573#c14
    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/ASL2.0'
        exclude 'META-INF/LICENSE.txt'
        exclude 'META-INF/NOTICE.txt'
    }
    sourceSets {
        main.assets.srcDirs = ['assets']
    }
    buildTypes {
        release {
            runProguard false
        }
        debug {
            runProguard false
        }
    }
}

dependencies {
    compile "com.msopentech.thali:ThaliUtilitiesAndroid:0.0.2"
    // This is a local build of an unreleased version of slf4j that fixes the double declaration issue they have
    // that makes it impossible to use Java code compiled with their 'base' JAR work with Android code.
    compile 'org.slf4j:slf4j-android:1.7.2'
}

def pathToResourcesInUniversalUtilities = "../../../Utilities/UniversalUtilities/src/main/resources/"

def pathToXhrTest = pathToResourcesInUniversalUtilities + "xhrtest"

println file(new File(pathToResourcesInUniversalUtilities))
println file(new File(pathToXhrTest))

task copyBridgeManager(type: Copy) {
    from pathToResourcesInUniversalUtilities + "BridgeManager.js"
    into 'assets'
}

task copyXhrTestFiles(type: Copy) {
    from pathToXhrTest
    into 'assets/xhrtest'
}

assemble.dependsOn copyBridgeManager, copyXhrTestFiles